import React from 'react'
//引入你的路由组件
import {Route,Redirect} from 'react-router-dom'
 class Home extends React.Component{
     constructor(){
         super()
         this.state={
             isLogin:JSON.parse(sessionStorage.getItem('isLogin'))  // true 或者null
         }
     }
    render(){
        const {isLogin} = this.state
            return (<div>
                {/* 根据存储状态，进行条件判断 */}
                {isLogin? <Route {...this.props}></Route> :<Redirect to='/'></Redirect> }
            </div>)
        }
}
 export default Home